package com.fdb.efp.nls.service.impl;
/**
 * 还款明细对账临时表
 * @description:TODO
 * @date:2018年12月28日 下午3:18:46
 * @author:cenyj
 */

import com.fdb.basic.framework.core.base.FrameworkService;
import com.fdb.efp.nls.service.dao.RepayDetailAcountTempDao;
import com.fdb.efp.nls.service.domain.RepayDetailAcountTemp;
import com.fdb.efp.nls.service.facade.RepayDetailAcountTempService;
import com.fdb.efp.nls.service.vo.RepayDetailAcountTempVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("repayDetailAcountTempService")
public class RepayDetailAcountTempServiceImpl implements RepayDetailAcountTempService,FrameworkService{
	private static Logger logger = LoggerFactory.getLogger(RepayDetailAcountTempServiceImpl.class);
	
	@Autowired
	private RepayDetailAcountTempDao repayDetailAcountTempDao;


	@Override
	public int insert(RepayDetailAcountTempVO record) {
		logger.debug("当前新增数据为:" + record.toString());
		int num = 0;
		try {
			RepayDetailAcountTemp queryRepayDetailAcountTemp = new RepayDetailAcountTemp();
			beanCopy(record, queryRepayDetailAcountTemp);
			num = repayDetailAcountTempDao.insert(queryRepayDetailAcountTemp);
		} catch (Exception e) {
			logger.error("新增数据发生异常!", e);
			num = -1;
		}
		logger.debug("当前新增数据条数为:" + num);
		return num;
	}

	@Override
	public int insertSelective(RepayDetailAcountTempVO record) {
		logger.debug("当前新增数据为:" + record.toString());
		int num = 0;
		try {
			RepayDetailAcountTemp queryRepayDetailAcountTemp = new RepayDetailAcountTemp();
			beanCopy(record, queryRepayDetailAcountTemp);
			num = repayDetailAcountTempDao.insert(queryRepayDetailAcountTemp);
		} catch (Exception e) {
			logger.error("新增数据发生异常!", e);
			num = -1;
		}
		logger.debug("当前新增数据条数为:" + num);
		return num;
	}

	@Override
	public List<RepayDetailAcountTempVO> getRepayDetailAcountTempList() {
		logger.debug("当前查询参数信息为:" );
		List<RepayDetailAcountTempVO> list = null;
		try {
			List<RepayDetailAcountTemp> repayDetailAcountTemps = repayDetailAcountTempDao.getRepayDetailAcountTempList();
			logger.debug("当前查询结果为:" + repayDetailAcountTemps.size());			
			list = (List<RepayDetailAcountTempVO>) beansCopy(repayDetailAcountTemps, RepayDetailAcountTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}

		return list;
	}

}
